package Work0508;

import java.util.Scanner;

public class GiftTest {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		GiftConvert test = new GiftConvert();
		while (true) {
			System.out.println("1.添加用户\t2.兑换礼物\t3.展示用户\t4.退出");
			System.out.print("请选择：");
			int a = in.nextInt();
			if (a == 1) {
				System.out.print("请输入用户编号：");
				String newName = in.next();
				boolean q = test.addUse(newName);
				System.out.println(q ? "添加成功" : "添加失败");
			} else if (a == 2) {
				System.out.println("1.100分兑换餐巾纸一包\t2.400分兑换剃须刀一把\t3.1000分兑换炒锅一个");
				System.out.print("请输入您的编号：");
				String newName = in.next();
				System.out.print("请输入要兑换的商品：");
				int b = in.nextInt();
				String p = test.duihuan(newName, b);
				if (p == null) {
					System.out.println("抱歉，未找到该用户。");
				} else {
					System.out.println(p);
				}
			} else if (a == 3) {
				test.showUse();
			} else if (a == 4) {
				break;
			}
		}

	}

}
